<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="id" name="id" value="${user.id!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">微信或者支付宝小程序id</label>
              <div class="layui-input-block">
                  <input type="text" id="openid" name="openid" value="${user.openid!}"  autocomplete="off" placeholder="请输入微信或者支付宝小程序id"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">微信或者支付宝</label>
              <div class="layui-input-block">
                  <input type="text" id="source" name="source" value="${user.source!}"  autocomplete="off" placeholder="请输入微信或者支付宝"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">用户名</label>
              <div class="layui-input-block">
                  <input type="text" id="userName" name="userName" value="${user.userName!}"  autocomplete="off" placeholder="请输入用户名"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">昵称</label>
              <div class="layui-input-block">
                  <input type="text" id="nick" name="nick" value="${user.nick!}"  autocomplete="off" placeholder="请输入昵称"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">照片</label>
              <div class="layui-input-block">
                  <input type="text" id="photo" name="photo" value="${user.photo!}"  autocomplete="off" placeholder="请输入照片"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">密码</label>
              <div class="layui-input-block">
                  <input type="text" id="passWord" name="passWord" value="${user.passWord!}"  autocomplete="off" placeholder="请输入密码"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">是否实名</label>
              <div class="layui-input-block">
                  <input type="text" id="ischeck" name="ischeck" value="${user.ischeck!}"  autocomplete="off" placeholder="请输入是否实名"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">注册时间</label>
              <div class="layui-input-block">
                  <input type="text" id="regTime" name="regTime" value="${user.regTime!}"  autocomplete="off" placeholder="请输入注册时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">手机号</label>
              <div class="layui-input-block">
                  <input type="text" id="phone" name="phone" value="${user.phone!}"  autocomplete="off" placeholder="请输入手机号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">性别</label>
              <div class="layui-input-block">
                  <input type="text" id="gereen" name="gereen" value="${user.gereen!}"  autocomplete="off" placeholder="请输入性别"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         id:$("#id").val(),
                         openid:$("#openid").val(),
                         source:$("#source").val(),
                         userName:$("#userName").val(),
                         nick:$("#nick").val(),
                         photo:$("#photo").val(),
                         passWord:$("#passWord").val(),
                         ischeck:$("#ischeck").val(),
                         regTime:$("#regTime").val(),
                         phone:$("#phone").val(),
                           gereen:$("#gereen").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/bus/user/editUser",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/bus/user/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#openid").val().length<1){
                       layer.msg("请输入微信或者支付宝小程序id");
                       return false;
                   }
                   if($("#source").val().length<1){
                       layer.msg("请输入微信或者支付宝");
                       return false;
                   }
                   if($("#userName").val().length<1){
                       layer.msg("请输入用户名");
                       return false;
                   }
                   if($("#nick").val().length<1){
                       layer.msg("请输入昵称");
                       return false;
                   }
                   if($("#photo").val().length<1){
                       layer.msg("请输入照片");
                       return false;
                   }
                   if($("#passWord").val().length<1){
                       layer.msg("请输入密码");
                       return false;
                   }
                   if($("#ischeck").val().length<1){
                       layer.msg("请输入是否实名");
                       return false;
                   }
                   if($("#regTime").val().length<1){
                       layer.msg("请输入注册时间");
                       return false;
                   }
                   if($("#phone").val().length<1){
                       layer.msg("请输入手机号");
                       return false;
                   }
                   if($("#gereen").val().length<1){
                       layer.msg("请输入性别");
                       return false;
                   }
        }
    });

</script>
</body>
</html>